import { LoginAction } from '@/types/store'
import { getToken } from '@/utils/storage'
// 页面刷新从本地获取token
const initState = getToken() || {}
const login = (state = initState, action: LoginAction) => {
  switch (action.type) {
    case 'SETTOKEN':
      return action.token

    default:
      return state
  }
}
export default login
